<template>
  <div id="hello">
    <div class="main-label">
      <div style="display: inline-block">
        联系客服维护
      </div>
      <el-button class="head-btn" @click="handleSubmit">保存</el-button>
    </div>
    <VueKindEditor id="editor_id" height="500px" width="100%" :content="editorText"
            :afterChange="afterChange()"
            pluginsPath="/static/kindeditor/plugins/"
            :loadStyleMode="false"
            @on-content-change="onContentChange"></VueKindEditor>

  </div>
</template>

<script>
    import VueKindEditor from 'vue-kindeditor/src/components/KindEditor.vue'
    import 'kindeditor/kindeditor-all-min.js'
    import 'kindeditor/themes/default/default.css'
    export default {
        name: 'hello',
        data () {
            return {
                editorText: '',
            }
        },
        created () {
        },
        methods: {
            onContentChange (val) {
                this.editorText = val
            },
            getHtml() {
                this.$http.get(this.$api.API_WORKBENCH_SERVICE).then(resp=>{
                    this.editorText = resp.announcement
                })
            },
            afterChange () {
            },
            handleSubmit() {
                this.$http.post(this.$api.API_ADD_CUSTOMER_SERVICE,{announcement:this.editorText}).then(resp=>{
                    this.$message.success('保存成功')
                })
            }
        },
        created(){
            this.getHtml()
        },
        components:{VueKindEditor}
    }
</script>

<style lang="less" scoped>
  .main-label{
    border: #ccc 1px solid;
    border-bottom: 0;
    height: 36px;
    line-height: 35px;
    font-weight: bold;
    padding-left: 5px;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .grid-content {
    min-height: 36px;
  }
  .head-btn{
    display: inline-flex;
    text-decoration: none;
    align-items: center;
    vertical-align: center;
    font: 8px/8px HelveticaNeue, Arial;
    padding: 0px 11px;
    border: 1px solid #FFF;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 9pt;
    margin-left: 2px;
    line-height: 25px;
    color: #000;
    outline: none;
    background-image: url(../../../assets/img/datagrid_header_bg.gif);
    background-repeat: repeat-x;
    border: 1px solid #ccc;
    &:hover {
      color: #FFF;
      filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#33bbee', endColorstr='#2288cc');
      border: 1px solid #d51900;
      background: linear-gradient(top, #d51900, #d51900);
      background: -moz-linear-gradient(top, #d51900, #d51900);
      background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#d51900), to(#d51900));
      text-shadow: -1px -1px 1px #1c6a9e;
    }
    /deep/span{
      display: block;
    }
  }

  /deep/.el-form-item__error {
    color: #F56C6C;
    font-size: 12px;
    line-height: 40px;
    position: absolute;
    padding: 0 5px !important;
    top: 0;
    left: 0;
  }
  /deep/.el-form-item {
    margin-bottom: 0px;
  }
  /deep/.el-input__inner{
    border-radius: 0px;
  }
  .el-row{
    display: flex;
    align-items: center;
    border: 1px solid #eee;
    .el-col:first-child{
      padding: 10px 0;
      border-right: 1px solid #eee;
    }
    .el-input{
      padding-right: 10px;
    }
    .el-textarea{
      padding-right: 10px;
    }
  }
</style>

